let isSubsequence = function(s, t){
    let sIndex = 0, tIndex = 0;
    while(tIndex < t.length){
        if(s[sIndex] == t[tIndex]){
            sIndex++
        }
        tIndex++
    }
    
    if(sIndex == s.length){
        return true
    }else{
        return false
    }
}

let s = "ace", t = "abcde"

console.log(isSubsequence(s, t))